package com.dcjt.firehotcarpad.retrofit1.service;


import com.aries.library.fast.retrofit.FastMultiUrl;
import com.dcjt.firehotcarpad.base.ApiPath;
import com.dcjt.firehotcarpad.entity.AroundWaterEntity;
import com.dcjt.firehotcarpad.entity.BaseEntity;
import com.dcjt.firehotcarpad.entity.BaseListEntity;
import com.dcjt.firehotcarpad.entity.BiaohuiEntity;
import com.dcjt.firehotcarpad.entity.CarCurrentDetailEntity;
import com.dcjt.firehotcarpad.entity.CarDetailEntity;
import com.dcjt.firehotcarpad.entity.CarZZXX;
import com.dcjt.firehotcarpad.entity.CheckLogin;
import com.dcjt.firehotcarpad.entity.CjXx;
import com.dcjt.firehotcarpad.entity.CombatTeamEntity;
import com.dcjt.firehotcarpad.entity.DictEntity;
import com.dcjt.firehotcarpad.entity.DisasterInfoEntity;
import com.dcjt.firehotcarpad.entity.InstructionListEntity;
import com.dcjt.firehotcarpad.entity.JigouDetailEntity;
import com.dcjt.firehotcarpad.entity.LoginResultEntity;
import com.dcjt.firehotcarpad.entity.SetCLZTBean;
import com.dcjt.firehotcarpad.entity.Template;
import com.dcjt.firehotcarpad.entity.VoiceFileEntity;
import com.dcjt.firehotcarpad.fragment.DisasterListInfoEntity;
import com.dcjt.firehotcarpad.fragment.WaterSourceEntity;

import java.util.List;

import io.reactivex.Observable;
import okhttp3.RequestBody;
import okhttp3.ResponseBody;
import retrofit2.http.Body;
import retrofit2.http.GET;
import retrofit2.http.Header;
import retrofit2.http.Headers;
import retrofit2.http.POST;
import retrofit2.http.Path;
import retrofit2.http.Query;
import retrofit2.http.Url;

public interface ApiServices {


    @GET(ApiPath.API_LOGIN)
//    @Headers("Content-Type:application/json")
    Observable<BaseEntity<LoginResultEntity>> login(@Query("username") String username, @Query("password") String password, @Query("dlzdlx") String dlzdlx, @Query("dlcslx") String dlcslx);
//    Observable<BaseEntity<List<UserEntity>>> login(@Body RequestBody json);


//    @POST(ApiPath.API_LOGIN)
//    Observable<Object> uploadDepartZBKS(@Body RequestBody json);

    @GET(ApiPath.API_CONFIG_TYPE)
    Observable<Object> getConfigData(@Query("configType") String configType);

    @GET(ApiPath.API_CONFIG_TYPE_JCJ)
    Observable<Object> getConfigDataJCJ(@Query("configType") String configType);

    @GET(ApiPath.API_CONFIG_TYPE_JCJ_APP)
    Observable<Object> getConfigDataJCJ_APP(@Query("configType") String configType);

    @Headers({FastMultiUrl.BASE_URL_NAME_HEADER + ApiPath.KEY_BASE_MESSAGE})
    @POST("{url}/mq/message")
    Observable<ResponseBody> sendMessage_zl(@Path("url") String url, @Body RequestBody body);

    @Headers({FastMultiUrl.BASE_URL_NAME_HEADER + ApiPath.KEY_BASE_MESSAGE})
//    @POST(ApiPath.API_TAKE)
    @GET("{url}/mq/message/take")
    Observable<ResponseBody> takeMessage(@Path("url") String url, @Body RequestBody body);

    @Headers({FastMultiUrl.BASE_URL_NAME_HEADER + ApiPath.KEY_BASE_MESSAGE})
//    @GET(ApiPath.API_TAKE)
    @GET("{url}/mq/message/take")
    Observable<ResponseBody> takeMessageGET(@Path("url") String url, @Query("aid") String aid, @Query("access_token") String access_token, @Query("uid") String uid,
                                            @Query("size") String size, @Query("confirm") String confirm, @Query("private") String imei);

    @Headers({FastMultiUrl.BASE_URL_NAME_HEADER + ApiPath.KEY_BASE_MESSAGE})
//    @GET(ApiPath.API_ADD_GROUP)
    @GET("{url}/mq/group/user/add")
    Observable<ResponseBody> addGroup(@Path("url") String url, @Query("aid") String aid, @Query("access_token") String access_token, @Query("gid") String gid,
                                      @Query("id") String id);


    @Headers({FastMultiUrl.BASE_URL_NAME_HEADER + ApiPath.KEY_BASE_MESSAGE})
//    @GET(ApiPath.API_GET_MESSAGE_CONFIG)
    @GET("{url}/app/array")
    Observable<ResponseBody> getConfigMessage(@Path("url") String url, @Query("uid") String uid, @Query("pwd") String pwd);

    @Headers({FastMultiUrl.BASE_URL_NAME_HEADER + ApiPath.KEY_BASE_MESSAGE})
//    @GET(ApiPath.API_GET_MESSAGE_CONFIG_REGISTER)
    @GET("{url}/app/register")
    Observable<ResponseBody> getConfigMessageRegister(@Path("url") String url, @Query("uid") String uid, @Query("pwd") String pwd, @Query("name") String name);

    /**
     * 警情列表
     *
     * @return
     */
    @POST(ApiPath.API_DISATER_LIST)
    Observable<BaseEntity<BaseListEntity<DisasterInfoEntity>>> getDisasterList(@Body RequestBody body, @Header("XFAuth") String token);

    /**
     * 智能推荐
     *
     * @return
     */
    @GET(ApiPath.API_DISATER_LIST_TJ)
    Observable<BaseEntity<BaseListEntity<DisasterInfoEntity>>> getIntelligentRecommendationDisasterList(@Header("XFAuth") String token);

    /**
     * 获取字典表
     *
     * @return
     */
    @GET(ApiPath.API_DISATER_DICT)
    Observable<BaseEntity<List<DictEntity>>> getDictList(@Query("code") String code, @Header("XFAuth") String token);

    /**
     * 获取机构列表
     *
     * @return
     */
    @GET(ApiPath.API_GET_JGLB)
    Observable<BaseEntity<List<JigouDetailEntity>>> getJigouList(@Query("jgid") String jgid);

    /**
     * 获取机构列表
     *
     * @return
     */
    @GET(ApiPath.API_GET_CLLB)
    Observable<BaseEntity<List<CarDetailEntity>>> getCarList(@Query("jgid") String jgid);

    /**
     * 修改场所类型
     *
     * @return
     */
    @GET(ApiPath.API_UPDATE_CSLX)
    Observable<BaseEntity<Object>> updateCSLX(@Query("id") String id, @Query("dlcslx") String dlcslx, @Header("XFAuth") String token);

    /**
     * 获取录音文件
     *
     * @return
     */
    @GET(ApiPath.API_GET_VOICE_FILE)
    Observable<BaseEntity<VoiceFileEntity>> getVoiceFile(@Query("zqid") String zqid, @Header("XFAuth") String token);

    /**
     * 车载平板-获取本车作战信息
     *
     * @return
     */
    @GET(ApiPath.API_GET_CAR_ZZXX)
    Observable<BaseEntity<CarZZXX>> getCarZuozhanXX(@Query("zqid") String zqid, @Query("clid") String clid, @Header("XFAuth") String token);

    /**
     * 车载平板-获取本车状态信息《本车 状态栏使用》
     *
     * @return
     */
    @GET(ApiPath.GET_CAR_DETAIL)
    Observable<BaseEntity<CarCurrentDetailEntity>> getCarStateDetail(@Query("clid") String clid, @Header("XFAuth") String token);
    /**
     * 获取标绘列表信息
     *
     * @return
     */
    @GET(ApiPath.GET_BIAOHUI_RECORD)
    Observable<BaseEntity<List<BiaohuiEntity>>> getBiaohuiList(@Query("ssbhid") String ssbhid, @Query("sszqid") String sszqid, @Header("XFAuth") String token);

    @GET(ApiPath.CHECK_USER_LOGIN)
    Observable<BaseEntity<CheckLogin>> checkUserLogin(@Query("username") String username, @Query("dlzdlx") String dlzdlx);


    /**
     * 获取警情详情
     *
     * @return
     */
//    @POST(ApiPath.API_DISATER_DEATIL)
//    Observable<BaseEntity<List<DisasterInfoEntity>>> getDisasterDetail(@Body RequestBody body, @Header("XFAuth") String token);
//    @POST(ApiPath.ChangeCalStatus)
//    @GET("{url}")
    @POST("cf/{url}")
    Observable<BaseEntity<SetCLZTBean>> changeCarStatus(@Path("url") String url, @Body RequestBody body, @Header("XFAuth") String token);
//    @POST(ApiPath.ChangeCalStatusWjq)
//    Observable<BaseEntity<Object>> changeCarStatusWjq(@Body RequestBody body, @Header("XFAuth") String token);

    @POST(ApiPath.sxhInfoList)
    Observable<BaseEntity<BaseListEntity<CjXx>>> getSxhInfo(@Body RequestBody body, @Header("XFAuth") String token);

    @POST(ApiPath.API_DISATER_DEATIL)
    Observable<BaseEntity<List<DisasterInfoEntity>>> getDisasterDetail(@Body RequestBody body, @Header("XFAuth") String token);


    /**
     * 获取周边水源
     *
     * @return
     */
    @GET(ApiPath.GET_AROUND_WATER)
    Observable<BaseEntity<List<AroundWaterEntity>>> getAroundWater(@Query("zqid") String zqid,
                                                                   @Query("layer") String layer,
                                                                   @Query("size") int size,
                                                                   @Query("current") int current,
                                                                   @Header("XFAuth") String token);


    /**
     * 获取警情列表
     *
     * @return
     */
    @GET(ApiPath.GET_DISASTER_LIST)
    Observable<BaseEntity<BaseListEntity<DisasterListInfoEntity>>> getDisasterList(@Query("clid") String clid,
                                                                                   @Query("size") int size,
                                                                                   @Query("current") int current,
                                                                                   @Header("XFAuth") String token);


    /**
     * 获取周边水源
     *
     * @return
     */
    @GET(ApiPath.GET_WATER_SOURCE_LIST)
    Observable<BaseEntity<BaseListEntity<WaterSourceEntity>>> getWaterSourceList(@Query("zqid") String zqid,
                                                                                 @Query("x") double x,
                                                                                 @Query("y") double y,
                                                                                 @Query("range") long range,
                                                                                 @Query("size") int size,
                                                                                 @Query("current") int current,
                                                                                 @Query("zblb") String zblb,
                                                                                 @Query("sfcllb") Boolean sfcllb,
                                                                                 @Header("XFAuth") String token);
    /**
     * 获取指令列表
     *
     * @return
     */
    @GET(ApiPath.GET_INSTRUCTION_LIST)
    Observable<BaseEntity<BaseListEntity<InstructionListEntity>>> getInstructionList(@Query("zqid") String zqid,
                                                                                     @Query("userid") String userid,
                                                                                     @Query("size") int size,
                                                                                     @Query("current") int current,
                                                                                     @Query("key") String key,
                                                                                     @Header("XFAuth") String token);
    /**
     * 修改指令列表
     *
     * @return
     */
//    @POST(ApiPath.UPLOAD_INSTRUCTION_STATE)
//    Observable<Object> uploadInstructionState(@Body RequestBody body, @Header("XFAuth") String token);
    @GET(ApiPath.UPLOAD_INSTRUCTION_STATE)
    Observable<Object> uploadInstructionState(@Query("zlid") String zlid,@Query("data") String data, @Header("XFAuth") String token);


    /**
     * 获取作战班
     *
     * @return
     */
    @GET(ApiPath.GET_COMBAT_TEAMS)
    Observable<BaseEntity<List<CombatTeamEntity>>> getCombatTeams(@Query("jgid") String zqid,
                                                                  @Header("XFAuth") String token);


    /**
     * 获取周边水源
     * depId, current, size, DataManager.getInstance().getUser().getToken())
     *
     * @return
     */
    @GET(ApiPath.GET_TEMPLATES)
    Observable<BaseEntity<List<Template>>> getTemplates(@Query("zzjg") String depid,
                                                        @Query("size") int size,
                                                        @Query("current") int current,
                                                        @Header("XFAuth") String token);


    @Headers({FastMultiUrl.BASE_URL_NAME_HEADER + ApiPath.KEY_BASE_UPLOAD_FILE})
    @POST
    Observable<BaseEntity<List<String>>> upLoadFile(@Body RequestBody body, @Url String url);


    @POST(ApiPath.SAVE_DOCUMENT)
    Observable<BaseEntity<Object>> saveDocument(@Body RequestBody body, @Header("XFAuth") String token);

    @POST(ApiPath.UPLOAD_WATER)
    Observable<BaseEntity<Object>> uploadWaterZLSY(@Body RequestBody body, @Header("XFAuth") String token);

}
